<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<head>
    <base href="<%=basePath%>" />
    
    <title>系统消息列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<link href="images/css.css"  rel="stylesheet" type="text/css" />
	<SCRIPT language=javascript src="js/popup.js"></SCRIPT>
	<SCRIPT language=javascript src="js/js.js"></SCRIPT>
	
	<script type='text/javascript' src='dwr/interface/userdwr.js'></script>

	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type='text/javascript' src='js/jquery.validate.min.js'></script>
 	<script type='text/javascript' src='js/common.js'></script>

	<script type='text/javascript' src='<%=basePath %>/dwr/engine.js'></script>
 	<script type='text/javascript' src='<%=basePath %>/dwr/util.js'></script>
	
<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.STYLE13 {color: #A3A3A3}
.STYLE15 {color: #F18910}


-->
</style>
<script type="text/javascript">

 //转至多少页码
 function changePage(listId)
 {
	  document.location.href="sysMsgAction!toEnterSysMsgList.action?pageNo="+listId;
 } 
</script>

 <script type="text/javascript">
var flag = false; //全选标识符标记

//多选删除提交
function delChkSubmit(){
	var fxChVal= duoXuanChk();
//	alert("fxChVal="+fxChVal);
	if(fxChVal != ""){
			if(confirm('您确定要删除多条记录？')){
				document.delCheckboxForm.submit();
			}else{
				return false;
			}

	}else{
		alert("请选择要删除的记录.");
		return false;
	}
	
  	
}

 function quanXuanChk(){
 	var ch = document.getElementsByName("chbox");
 	var allchk = document.getElementsByName("allchk"); //全选按钮
	
	//var fuzhi = document.getElementById("txtVal");
	var hqValue="";
	
 	for(j=0;j <allchk.length;j++) {
 		//alert(">>>>"+allchk[i].checked);
 		if(allchk[j].checked == true){ //如果点击了全选按钮，就标记着复选框全部选中
			for(i=0;i <ch.length;i++) {
			//	alert("Chk_checked="+ch[i].checked); 
				if(ch[i].checked == false){
				//	alert("设置为复选框选中");
					ch[i].checked = true;  //设置为复选框选中
					if(i == (ch.length-1)){
						hqValue = hqValue+ch[i].value;
					 }else{
					    hqValue = (hqValue+ch[i].value)+"_";
					 }
				//	alert(">>"+hqValue);
				}
			}
			 flag = true;
		//	 alert("全选>>"+hqValue);
			 $("#sysMsgId").val(hqValue);  //给隐藏域赋值		
		}else{
	 		for(i=0;i <ch.length;i++) {
				//alert("Chk_checked="+ch[i].checked); 
				if(ch[i].checked == true ){
				//	alert("设置为不选中");
					ch[i].checked = false;  //设置为复选框不选中
				}
			}
			flag = false;
	 	}  
 	} 
 	  //document.getElementById("sysMsgId").value= hqValue;
 }
//点击发送事件调用
 function duoXuanChk(){ //复选框选择多个
 	var ch = document.getElementsByName("chbox");
	var hqValue="";
			for(i=0;i < ch.length;i++) {
			//	alert("Chk_checked="+ch[i].checked); 
				if(ch[i].checked == true){				
					hqValue = (hqValue+ch[i].value)+"_";
				//	alert(">>"+hqValue);
				}
			 }
			 if(hqValue !=""){
			 	//alert("多选>>"+hqValue);
			    $("#sysMsgId").val(hqValue);  //给隐藏域赋值
			 }
	return hqValue;	 
 	  //document.getElementById("sysMsgId").value= hqValue;
 }

</script>
 

</head>
  
<body style="margin:0px; text-align:center;" onLoad="parent.document.all.iHeight.height=this.document.body.scrollHeight+10;"  bgcolor="#F1F1F1" >

<table width="789" height="539" border="0" cellpadding="0" cellspacing="0" bgcolor="#F1F1F1">
  <tr>
    <td width="789" height="39" align="left" valign="middle"><span class="STYLE1">&nbsp;<a href="javascript:void(parent.window.location.href='loginAction!login.action')" class="STYLE1">我的易彩通</a> &gt; 我的账号 &gt; 系统消息</span></td>
  </tr>
  <tr>
    <td height="500" align="center" valign="top" bgcolor="#FFFFFF" style="border:1px solid #C5C5C5; padding:1px ;">
    <table width="100%" height="32" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="1%" height="32" background="images/sp_bg.jpg">&nbsp;</td>
        <td width="3%" align="center" background="images/sp_bg.jpg" style="border-bottom:1px solid #C5C5C5;"><img src="images/dian.jpg" width="10" height="16" /></td>
        <td width="95%" align="left" background="images/sp_bg.jpg" style="border-bottom:1px solid #C5C5C5;"><span class="STYLE3">系统消息</span></td>
        <td width="1%" background="images/sp_bg.jpg">&nbsp;</td>
      </tr>
    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="8">&nbsp;</td>
        </tr>
      </table>
<s:form name="delCheckboxForm" id="delCheckboxForm" action="sysMsgAction!delAllSysMsgRecord.action" method="post" >     
      <table width="766" height="90" border="0" cellpadding="0" cellspacing="0">
       <%-- 标题显示 --%> 
        <tr>
          <td width="44" align="center" background="images/lm1_bg.jpg">选择</td>
          <td width="10" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="26" /></td>
          <td width="49" align="center" background="images/lm1_bg.jpg">状态</td>
          <td width="10" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="26" /></td>
          <td width="93" align="center" background="images/lm1_bg.jpg">发件人</td>
          <td width="15" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="26" /></td>
          <td width="254" align="center" background="images/lm1_bg.jpg">消息标题</td>
          <td width="10" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="26" /></td>
          <td width="147" align="center" background="images/lm1_bg.jpg">接收时间</td>
          <td width="10" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" alt="" width="10" height="26" /></td>
          <td width="127" align="center" background="images/lm1_bg.jpg">操作</td>
        </tr>
        
        <%-- 把所有全选的值赋值给隐藏域，提交到后台获取 --%>
        <s:hidden name="sysMsgId" id="sysMsgId" value="" />
        
        <%-- 显示数据的列表 --%>
        <s:iterator value="pageSysMsgObj.data" id="sysMsgObj" status="st">
        <tr <s:if test="#st.odd">style='background-color:#F7F7F7'</s:if>>
          <td height="28" align="center">
          	<input type="checkbox" name="chbox" id="chbox" value="<s:property value="pageSysMsgObj.data[#st.index].id"/>">
          </td>
          <td>&nbsp;</td>
          <td align="center">
          	<s:if test="#sysMsgObj.status == 1"> <%-- 0未读， 1已读 --%>
          		<img src="images/zt2.jpg" width="14" height="11">
          	</s:if>
          	<s:else>
          		<img src="images/zt1.jpg" width="14" height="12">
          	</s:else>
          </td>
          <td>&nbsp;</td>
          <td align="center"><s:property value="pageSysMsgObj.data[#st.index].sender"/></td>
          <td align="center">&nbsp;</td>
          <td align="left"><s:property value="pageSysMsgObj.data[#st.index].title"/></td>
          <td align="center">&nbsp;</td>
          <td align="center"><s:date name="pageSysMsgObj.data[#st.index].sendTime" format="yyyy-MM-dd HH:mm:ss"/></td>
          <td align="center">&nbsp;</td>
          <td align="center">

	          <table width="106" border="0" cellpadding="0" cellspacing="0">
	            <tr>
	              <td width="17"><img src="images/ck1.jpg" width="16" height="17"></td>
	              <td width="31"><a href="sysMsgAction!showSysMsgDetail.action?sysMsgId=<s:property value="pageSysMsgObj.data[#st.index].id"/>">查看</a></td>
	              <td width="13" align="center">|</td>
	              <td width="19"><img src="images/sc1.jpg" width="17" height="17" ></td>
	              <td width="26">
	              <a href="sysMsgAction!delSysMsgRecord.action?sysMsgId=<s:property value="pageSysMsgObj.data[#st.index].id"/>" onClick="javascript:return confirm('您确定要删除此信息？')">删除</a>
	              </td>
	            </tr>
	          </table>

          </td>
        </tr>
        </s:iterator>
         <%-- 展示列表结束 --%>      
           
        <tr>
          <td height="29" colspan="11" align="center" background="images/lm1_bg.jpg" >
          
          <!-- 分页 -->
<table width="765" border="0" cellspacing="0" cellpadding="0">
   <s:if test="pageSysMsgObj.data != null">
        <s:if test="pageSysMsgObj.hasOnePage==false">
			<s:form action="sysMsgAction!toEnterSysMsgList.action" method="post" id="sysMsgfrm" name="sysMsgfrm">
            <tr>
              <td width="42" height="22" align="center"><input type="checkbox" name="allchk" onclick="javascript:quanXuanChk();" ></td>
              <td width="42">全选</td>
              <td width="66"><img src="images/sc2.jpg" style="cursor:hand" width="66" height="19" onClick="javascript:delChkSubmit();"></td>
              <td width="106">&nbsp;</td>
              <td width="509" align="right">
              
              <s:if test="pageSysMsgObj.pageNo==1">首页</s:if>
			  <s:else>
				  <a href="sysMsgAction!toEnterSysMsgList.action?pageNo=1" class="STYLE5">首页</a> 
			  </s:else>&nbsp;
              
              <s:if test="pageSysMsgObj.hasPrePage==false">上一页</s:if>
			  <s:else> 
				 <a href="sysMsgAction!toEnterSysMsgList.action?pageNo=<s:property value="pageSysMsgObj.pageNo-1"/>" class="STYLE5">上一页</a>
			  </s:else>&nbsp;

              <s:if test="pageSysMsgObj.hasNextPage==false">下一页</s:if>
		      <s:else>
				 <a href="sysMsgAction!toEnterSysMsgList.action?pageNo=<s:property value="pageSysMsgObj.pageNo+1"/>" class="STYLE5">下一页</a>
			  </s:else>&nbsp;
              
              <s:if test="pageSysMsgObj.pageNo==pageSysMsgObj.totalPage">末页</s:if>
			  <s:else>
			    <a href="sysMsgAction!toEnterSysMsgList.action?pageNo=<s:property value="pageSysMsgObj.totalPage"/>" class="STYLE5"> 末页 </a>
			  </s:else>
              
              &nbsp;&nbsp;第${pageSysMsgObj.pageNo}页&nbsp;|&nbsp;
                                    共<s:property value="pageSysMsgObj.totalPage"/>页&nbsp;|&nbsp;
                                    共${pageSysMsgObj.totalRecord}条&nbsp;&nbsp;转至&nbsp;
    			<select onchange="changePage(this.value)" id="pageNo" name="pageNo">
    				<s:iterator value="pageSysMsgObj.listNum" id="msgid" status="st">
    					<option value="<s:property value="pageSysMsgObj.listNum[#st.index]"/>"><s:property value="pageSysMsgObj.listNum[#st.index]"/></option>
    				</s:iterator>
    			</select>&nbsp;&nbsp;
                
              </td>
            </tr>
            </s:form>
         </s:if>
         <s:else>
            	<tr>
	              <td height="29" align="right" background="images/lm1_bg.jpg" >
				 	首页&nbsp;上一页&nbsp;下一页&nbsp;末页           
	              	&nbsp;&nbsp;第1页&nbsp;|&nbsp;共1页&nbsp;|&nbsp;&nbsp;
	    		  </td>
	            </tr>
         </s:else>
            
   </s:if>
   <s:else>
          <tr>
		      <td height="29" align="center" background="images/lm1_bg.jpg" >
				<p style="color: red;font-size: 12px;text-align: center;">暂无系统消息记录!</p>
		      </td>
		  </tr>	 
  </s:else>	 
  <%-- 分页结束 --%>
</table>
                      
          </td>
        </tr>
        <tr>
          <td height="25" colspan="11" align="right" class="STYLE15">&nbsp;</td>
        </tr>
      </table>

</s:form>
	  	  
	  </td>
  </tr>
</table>
<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="8">&nbsp;</td>
  </tr>
</table>

</body>

</html>

<script type="text/javascript">
function open1(url)
{
var r=parseInt(Math.random()*1000);
window.showModalDialog(url,window,'status:no;help:no;dialogHeight:360px; dialogWidth:450px');
}
function open2(url)
{
window.showModalDialog(url,window,'status:no;help:no;dialogHeight:900px; dialogWidth:930px');
}
</script>